package jmine.tec.subscription.replicator;

import jmine.tec.subscription.Publication;
import jmine.tec.subscription.Publisher;
import jmine.tec.subscription.SubscriptionManager;
import jmine.tec.subscription.SubscriptionSettings;
import jmine.tec.subscription.impl.PartialPublication;
import jmine.tec.subscription.impl.SubscriptionManagerImplementor;

/**
 * Responsavel por replicar as publicacoes entre nos de um cluster.
 * 
 * @author takeshi
 */
public interface PublicationReplicator {

    /**
     * Sincroniza uma publica
     * 
     * @param <P> o tipo concreto da publication
     * @param publisher {@link Publisher} de P
     * @param settings {@link SubscriptionSettings}
     * @param publication {@link PartialPublication}
     * @param source {@link SubscriptionManager} que gerou a {@link PartialPublication}
     */
    <P extends Publication> void synchronizePartialPublication(Publisher<P> publisher, SubscriptionSettings settings,
            PartialPublication<P> publication, SubscriptionManager source);

    /**
     * Instala o {@link SubscriptionManagerImplementor} neste replicator
     * 
     * @param smi {@link SubscriptionManagerImplementor}
     */
    void setSubscriptionManager(SubscriptionManagerImplementor smi);

}
